package cn.edu.lit.jsjxy.CourseExample.chapter4;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.MediaController;
import android.widget.VideoView;

import cn.edu.lit.jsjxy.CourseExample.R;

public class VideoViewActivity extends Activity
{
    MediaController mMediaController;
    private VideoView mVideoView;
    private Button playBtn;

    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_video_view);
        mVideoView = new VideoView(this);
        mVideoView = (VideoView) findViewById(R.id.video);
        mMediaController = new MediaController(this);
        playBtn = (Button) findViewById(R.id.playButton);
        playBtn.setOnClickListener(new mClick());
    }

    class mClick implements View.OnClickListener
    {
        @Override
        public void onClick(View v)
        {
            String path = "/sdcard/test.3gp";
            mVideoView.setVideoPath(path);
            mMediaController.setMediaPlayer(mVideoView);
            mVideoView.setMediaController(mMediaController);
            mVideoView.start();
        }
    }
}
